package com.yjq.programmer.controller.admin;

import com.yjq.programmer.dto.LyricsDTO;
import com.yjq.programmer.dto.PageDTO;
import com.yjq.programmer.dto.ResponseDTO;
import com.yjq.programmer.service.ILyricsService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 杨杨吖
 * @QQ 823208782
 * @WX yjqi12345678
 * @create 2022-11-13 17:48
 */
@RestController("AdminLyricsController")
@RequestMapping("/admin/lyrics")
public class LyricsController {

    @Resource
    private ILyricsService lyricsService;

    /**
     * 分页获取歌词数据
     * @param pageDTO
     * @return
     */
    @PostMapping("/list")
    public ResponseDTO<PageDTO<LyricsDTO>> getLyricsListByPage(@RequestBody PageDTO<LyricsDTO> pageDTO){
        return lyricsService.getLyricsListByPage(pageDTO);
    }

    /**
     * 保存歌词数据(添加、修改)
     * @param lyricsDTO
     * @return
     */
    @PostMapping("/save")
    public ResponseDTO<Boolean> saveLyrics(@RequestBody LyricsDTO lyricsDTO){
        return lyricsService.saveLyrics(lyricsDTO);
    }

    /**
     * 删除歌词数据
     * @param lyricsDTO
     * @return
     */
    @PostMapping("/remove")
    public ResponseDTO<Boolean> removeLyrics(@RequestBody LyricsDTO lyricsDTO){
        return lyricsService.removeLyrics(lyricsDTO);
    }

}
